package drds.configuration.ddlparser.parser;

import drds.configuration.ddlparser.ddl.CreateTable;
import drds.configuration.ddlparser.ddl.ER.DeleteColumnERRefrence;
import drds.configuration.ddlparser.ddl.SqlObject;
import drds.configuration.ddlparser.ddl.add.AddColumn;
import drds.configuration.ddlparser.ddl.add.AddIndex;
import drds.configuration.ddlparser.ddl.drop.DeleteColumn;
import drds.configuration.ddlparser.ddl.drop.DropIndex;
import drds.configuration.ddlparser.ddl.drop.DropTable;
import drds.configuration.ddlparser.ddl.table.Column;
import drds.configuration.ddlparser.ddl.table.DataType;
import drds.configuration.ddlparser.ddl.table.IndexType;
import drds.configuration.ddlparser.ddl.table.PrimaryKeyStrategy;
import drds.configuration.ddlparser.ddl.update.UpdateColumn;
import drds.configuration.ddlparser.ddl.update.UpdateColumnName;
import drds.configuration.ddlparser.ddl.update.UpdateColumnPostion;
import drds.configuration.ddlparser.ddl.update.UpdateTableName;

/**
 * ddl核心解析器,该解析器具备分布式设计模式
 *
 * @author 曹正辉<3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               9                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               7                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               5                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               @                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               qq.com>
 */
public class Parser {
    //
    private Lexer lexer;

    public Parser(Lexer lexer) {
        this.lexer = lexer;
    }

    public static void newLine() {
        System.out.print("\r\n");
    }

    public static void show(Mark mark) {
        System.out.print(mark.name);
    }

    public static void show(String string) {
        System.out.print(" ");
        System.out.print("'" + string + "'");
    }

    public static void showWithOutSpace(String string) {
        System.out.print("'" + string + "'");
    }

    public static void showLength(int length) {
        System.out.print("(" + length + ")");
    }

    public static void showIntegerAndPrecision(int integer, int precision) {
        System.out.print("(" + integer + "," + precision + ")");
    }

    /**
     * <pre>
     *     增加列： alter table 表名 add ( 字段名，字段属性，【默认值（default expr)】),…);
     * 修改列： alter table 表名 modify字段名，字段属性；
     * 删除列： alter table 表名 drop 字段名；
     * 修改列名：alter table 字段名 change 新字段名 字段属性;
     * !modify与change的唯一区别就是modify不能修改字段名，而change必须要修改字段名。
     * 2.2修改*表名***alter table 原表名 rename to 新表名；
     *
     * </pre>
     */
    public SqlObject parseDDL() {
        lexer.nextMark();
        if (lexer.getMark() == Mark.EOF) {
            return null;
        }
        //按照优先级进行解析,要不然很乱
        if (lexer.getMark() == Mark.CREATE) {
            lexer.nextMark();
            if (lexer.getMark() == Mark.TABLE) {
                return parseCreateTable();
            }
        } else if (lexer.getMark() == Mark.DROP) {
            lexer.nextMark();
            if (lexer.getMark() == Mark.TABLE) {
                return parseDropTable();
            }
        } else if (lexer.getMark() == Mark.ALTER) {
            lexer.nextMark();
            if (lexer.getMark() == Mark.TABLE) {
                return parseAlterTable();
            }
        }
        System.out.println(lexer.mark);
        return null;

    }


    public SqlObject parseCreateTable() {
        CreateTable createTable = new CreateTable();
        //
        lexer.check(Mark.TABLE);
        lexer.nextMark();
        //
        lexer.check(Mark.IDENTIFIER);
        String tableName = lexer.stringValue;
        createTable.setTableName(tableName);
        lexer.nextMark();
        //
        lexer.check(Mark.LEFT_BRACE);
        show(Mark.LEFT_BRACE);
        newLine();
        lexer.nextMark();
        //
        if (lexer.mark != Mark.IDENTIFIER) {
            throw new IllegalArgumentException("请按照标准的drds表定义进行定义数据库表\n");
        } else {
            //auto_increment/sequence
            while (lexer.mark == Mark.IDENTIFIER) {
                Column column = new Column();
                String columnName = lexer.stringValue;
                column.setColumnName(columnName);
                if (createTable.columnMap.containsKey(columnName)) {
                    throw new IllegalArgumentException("字段已经存在 of" + createTable.getTableName() + ":" + columnName);
                }
                createTable.columnList.add(column);
                createTable.columnMap.put(columnName, column);
                lexer.nextMark();
                //
                //数字才会有有符号和无符号的分别
                if (lexer.mark == Mark.TINYINT ||//
                        lexer.mark == Mark.SMALLINT ||//
                        lexer.mark == Mark.MEDIUMINT ||//
                        lexer.mark == Mark.INT ||//
                        lexer.mark == Mark.BIGINT) {//
                    column.setDataType(lexer.mark);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.LEFT_PAREN);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.INT);//整数
                    String length = lexer.intOrDecimalValue();
                    column.setLength(Integer.parseInt(length));
                    showLength(column.getLength());
                    lexer.nextMark();
                    //
                    lexer.check(Mark.RIGHT_PAREN);
                    lexer.nextMark();
                    //
                    if (lexer.mark == Mark.UNSIGNED) {
                        column.setUnsigned();
                        lexer.nextMark();
                    }
                    //
                    lexer.check(Mark.DEFAULT);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.STRING);
                    String defaultValue = lexer.stringValue;
                    column.setDefaultValue(defaultValue);
                    show(defaultValue);
                    lexer.nextMark();
                    //
                    if (lexer.mark == Mark.PRIMARY) {
                        boolean check = !column.isUnsigned() && column.getDataType().equals(DataType.BIGINT);
                        if (!check) {
                            throw new RuntimeException("主键要求必须是符号bigint");
                        }
                        //检查是否需要主键策略
                        //primary key auto_incremen/sequence
                        lexer.check(Mark.PRIMARY);
                        lexer.nextMark();
                        //
                        lexer.check(Mark.KEY);
                        lexer.nextMark();
                        column.setSupportPrimaryKey(true);
                        //
                        lexer.check(Mark.IDENTIFIER);
                        String stringValue = lexer.stringValue;
                        if ("auto_increment".equals(stringValue)) {
                            column.setPrimaryKeyStrategy(PrimaryKeyStrategy.auto_increment);
                        } else if ("sequence".equals(stringValue)) {
                            column.setPrimaryKeyStrategy(PrimaryKeyStrategy.sequence);
                        } else {
                            throw new RuntimeException("暂时只支持auto_incremen/sequence两种自动序列设置方式");
                        }
                        lexer.nextMark();
                    }


                    //
                } else if (lexer.mark == Mark.DECIMAL) {
                    column.setDataType(lexer.mark);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.LEFT_PAREN);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.INT);
                    String length = lexer.intOrDecimalValue();
                    column.setLength(Integer.parseInt(length));
                    lexer.nextMark();
                    //
                    lexer.check(Mark.COMMA);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.INT);
                    String precision = lexer.intOrDecimalValue();
                    column.setPrecision(Integer.parseInt(precision));
                    showIntegerAndPrecision(column.getInteger(), column.getPrecision());
                    lexer.nextMark();
                    //
                    lexer.check(Mark.RIGHT_PAREN);
                    lexer.nextMark();
                    //
                    if (lexer.mark == Mark.UNSIGNED) {
                        column.setUnsigned();
                        lexer.nextMark();
                    }
                    //
                    lexer.check(Mark.DEFAULT);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.STRING);
                    String defaultValue = lexer.stringValue;
                    column.setDefaultValue(defaultValue);
                    show(defaultValue);
                    lexer.nextMark();
                    //
                } else if (lexer.mark == Mark.CHAR || lexer.mark == Mark.VARCHAR) {
                    column.setDataType(lexer.mark);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.LEFT_PAREN);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.INT);
                    String length = lexer.intOrDecimalValue();
                    column.setLength(Integer.parseInt(length));
                    lexer.nextMark();
                    //
                    lexer.check(Mark.RIGHT_PAREN);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.DEFAULT);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.STRING);
                    String defaultValue = lexer.stringValue;
                    column.setDefaultValue(defaultValue);
                    show(defaultValue);
                    lexer.nextMark();
                    //
                } else if (lexer.mark == Mark.DATE_TIME_LONG) {
                    column.setDataType(Mark.DATE_TIME_LONG);
                    lexer.nextMark();
                    //
                }
                show(lexer.mark);
                newLine();
                if (lexer.mark == Mark.COMMA) {//末尾都是以,结尾
                    lexer.nextMark();
                    //可能是下一列或者是}
                    continue;
                } else if (lexer.mark == Mark.RIGHT_BRACE) {//}结尾
                    break;
                }

            }
            // end while
            lexer.check(Mark.RIGHT_BRACE);
            show(Mark.RIGHT_BRACE);
            lexer.nextMark();
            //
            lexer.check(Mark.SEMICOLON);
            show(Mark.SEMICOLON);
            lexer.nextMark();
            //
            newLine();

        }
        System.out.println();
        System.out.println("解析table成功:" + tableName);
        return createTable;
    }//创建表

    public SqlObject parseDropTable() {
        // lexer.check(Mark.DROP);
        // lexer.nextMark();
        lexer.check(Mark.TABLE);
        lexer.nextMark();
        //
        lexer.check(Mark.IDENTIFIER);
        String tableName = lexer.stringValue;
        DropTable dropTable = new DropTable();
        dropTable.setTableName(tableName);
        lexer.nextMark();
        //
        return dropTable;
    }//删除表


    /**
     * <pre>
     *     增加列： alter table 表名 add ( 字段名，字段属性，【默认值（default expr)】),…);
     * 修改列： alter table 表名 modify字段名，字段属性；
     * 删除列： alter table 表名 drop 字段名；
     * 修改列名：alter table 字段名 change 新字段名 字段属性;
     * !modify与change的唯一区别就是modify不能修改字段名，而change必须要修改字段名。
     * 2.2修改*表名***alter table 原表名 rename to 新表名；
     *
     * </pre>
     */
    private SqlObject parseAlterTable() {
        // lexer.check(Mark.ALTER);
        // lexer.nextMark();
        lexer.check(Mark.TABLE);
        lexer.nextMark();
        //
        lexer.check(Mark.IDENTIFIER);
        String tableName = lexer.stringValue;
        lexer.nextMark();
        //
        // 上面是修改表名
        if (lexer.mark == Mark.ADD) {
            //优先是增加字段和修改字段
            lexer.nextMark();
            //
            // 添加和修改列定义
            if (lexer.mark == Mark.COLUMN) {
                lexer.nextMark();
                //
                AddColumn column = new AddColumn();
                column.setTableName(tableName);
                String columnName = lexer.stringValue;
                column.setColumnName(columnName);

                lexer.nextMark();
                //
                //数字才会有有符号和无符号的分别
                if (lexer.mark == Mark.TINYINT ||//
                        lexer.mark == Mark.SMALLINT ||//
                        lexer.mark == Mark.MEDIUMINT ||//
                        lexer.mark == Mark.INT ||//
                        lexer.mark == Mark.BIGINT) {//
                    column.setDataType(lexer.mark);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.LEFT_PAREN);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.INT);//整数
                    String length = lexer.intOrDecimalValue();
                    column.setLength(Integer.parseInt(length));
                    showLength(column.getLength());
                    lexer.nextMark();
                    //
                    lexer.check(Mark.RIGHT_PAREN);
                    lexer.nextMark();
                    //
                    if (lexer.mark == Mark.UNSIGNED) {
                        column.setUnsigned();
                        lexer.nextMark();
                    }
                    //
                    lexer.check(Mark.DEFAULT);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.STRING);
                    String defaultValue = lexer.stringValue;
                    column.setDefaultValue(defaultValue);
                    show(defaultValue);
                    lexer.nextMark();
                    //
                    if (lexer.mark == Mark.PRIMARY) {
                        boolean check = !column.isUnsigned() && column.getDataType().equals(DataType.BIGINT);
                        if (!check) {
                            throw new RuntimeException("主键要求必须是符号bigint");
                        }
                        //检查是否需要主键策略
                        //primary key auto_incremen/sequence
                        lexer.check(Mark.PRIMARY);
                        lexer.nextMark();
                        //
                        lexer.check(Mark.KEY);
                        lexer.nextMark();
                        column.setSupportPrimaryKey(true);
                        //
                        lexer.check(Mark.IDENTIFIER);
                        String stringValue = lexer.stringValue;
                        if ("auto_increment".equals(stringValue)) {
                            column.setPrimaryKeyStrategy(PrimaryKeyStrategy.auto_increment);
                        } else if ("sequence".equals(stringValue)) {
                            column.setPrimaryKeyStrategy(PrimaryKeyStrategy.sequence);
                        } else {
                            throw new RuntimeException("暂时只支持auto_incremen/sequence两种自动序列设置方式");
                        }
                        lexer.nextMark();
                    }


                    //
                } else if (lexer.mark == Mark.DECIMAL) {
                    column.setDataType(lexer.mark);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.LEFT_PAREN);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.INT);
                    String length = lexer.intOrDecimalValue();
                    column.setLength(Integer.parseInt(length));
                    lexer.nextMark();
                    //
                    lexer.check(Mark.COMMA);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.INT);
                    String precision = lexer.intOrDecimalValue();
                    column.setPrecision(Integer.parseInt(precision));
                    showIntegerAndPrecision(column.getInteger(), column.getPrecision());
                    lexer.nextMark();
                    //
                    lexer.check(Mark.RIGHT_PAREN);
                    lexer.nextMark();
                    //
                    if (lexer.mark == Mark.UNSIGNED) {
                        column.setUnsigned();
                        lexer.nextMark();
                    }
                    //
                    lexer.check(Mark.DEFAULT);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.STRING);
                    String defaultValue = lexer.stringValue;
                    column.setDefaultValue(defaultValue);
                    show(defaultValue);
                    lexer.nextMark();
                    //
                } else if (lexer.mark == Mark.CHAR || lexer.mark == Mark.VARCHAR) {
                    column.setDataType(lexer.mark);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.LEFT_PAREN);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.INT);
                    String length = lexer.intOrDecimalValue();
                    column.setLength(Integer.parseInt(length));
                    lexer.nextMark();
                    //
                    lexer.check(Mark.RIGHT_PAREN);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.DEFAULT);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.STRING);
                    String defaultValue = lexer.stringValue;
                    column.setDefaultValue(defaultValue);
                    show(defaultValue);
                    lexer.nextMark();
                    //
                } else if (lexer.mark == Mark.DATE_TIME_LONG) {
                    column.setDataType(Mark.DATE_TIME_LONG);
                    lexer.nextMark();
                    //
                }
                show(lexer.mark);
                newLine();
                lexer.check(Mark.SEMICOLON);
            }//end 增加字段列信息
        } else if (lexer.mark == Mark.MODIFY) {
            //优先是增加字段和修改字段
            lexer.nextMark();
            //
            lexer.check(Mark.COLUMN);
            lexer.nextMark();
            //
            UpdateColumn column = new UpdateColumn();
            column.setTableName(tableName);
            String columnName = lexer.stringValue;
            column.setColumnName(columnName);

            lexer.nextMark();
            //
            //数字才会有有符号和无符号的分别
            if (lexer.mark == Mark.TINYINT ||//
                    lexer.mark == Mark.SMALLINT ||//
                    lexer.mark == Mark.MEDIUMINT ||//
                    lexer.mark == Mark.INT ||//
                    lexer.mark == Mark.BIGINT) {//
                column.setDataType(lexer.mark);
                lexer.nextMark();
                //
                lexer.check(Mark.LEFT_PAREN);
                lexer.nextMark();
                //
                lexer.check(Mark.INT);//整数
                String length = lexer.intOrDecimalValue();
                column.setLength(Integer.parseInt(length));
                showLength(column.getLength());
                lexer.nextMark();
                //
                lexer.check(Mark.RIGHT_PAREN);
                lexer.nextMark();
                //
                if (lexer.mark == Mark.UNSIGNED) {
                    column.setUnsigned();
                    lexer.nextMark();
                }
                //
                lexer.check(Mark.DEFAULT);
                lexer.nextMark();
                //
                lexer.check(Mark.STRING);
                String defaultValue = lexer.stringValue;
                column.setDefaultValue(defaultValue);
                show(defaultValue);
                lexer.nextMark();
                //
                if (lexer.mark == Mark.PRIMARY) {
                    boolean check = !column.isUnsigned() && column.getDataType().equals(DataType.BIGINT);
                    if (!check) {
                        throw new RuntimeException("主键要求必须是符号bigint");
                    }
                    //检查是否需要主键策略
                    //primary key auto_incremen/sequence
                    lexer.check(Mark.PRIMARY);
                    lexer.nextMark();
                    //
                    lexer.check(Mark.KEY);
                    lexer.nextMark();
                    column.setSupportPrimaryKey(true);
                    //
                    lexer.check(Mark.IDENTIFIER);
                    String stringValue = lexer.stringValue;
                    if ("auto_increment".equals(stringValue)) {
                        column.setPrimaryKeyStrategy(PrimaryKeyStrategy.auto_increment);
                    } else if ("sequence".equals(stringValue)) {
                        column.setPrimaryKeyStrategy(PrimaryKeyStrategy.sequence);
                    } else {
                        throw new RuntimeException("暂时只支持auto_incremen/sequence两种自动序列设置方式");
                    }
                    lexer.nextMark();
                }


                //
            } else if (lexer.mark == Mark.DECIMAL) {
                column.setDataType(lexer.mark);
                lexer.nextMark();
                //
                lexer.check(Mark.LEFT_PAREN);
                lexer.nextMark();
                //
                lexer.check(Mark.INT);
                String length = lexer.intOrDecimalValue();
                column.setLength(Integer.parseInt(length));
                lexer.nextMark();
                //
                lexer.check(Mark.COMMA);
                lexer.nextMark();
                //
                lexer.check(Mark.INT);
                String precision = lexer.intOrDecimalValue();
                column.setPrecision(Integer.parseInt(precision));
                showIntegerAndPrecision(column.getInteger(), column.getPrecision());
                lexer.nextMark();
                //
                lexer.check(Mark.RIGHT_PAREN);
                lexer.nextMark();
                //
                if (lexer.mark == Mark.UNSIGNED) {
                    column.setUnsigned();
                    lexer.nextMark();
                }
                //
                lexer.check(Mark.DEFAULT);
                lexer.nextMark();
                //
                lexer.check(Mark.STRING);
                String defaultValue = lexer.stringValue;
                column.setDefaultValue(defaultValue);
                show(defaultValue);
                lexer.nextMark();
                //
            } else if (lexer.mark == Mark.CHAR || lexer.mark == Mark.VARCHAR) {
                column.setDataType(lexer.mark);
                lexer.nextMark();
                //
                lexer.check(Mark.LEFT_PAREN);
                lexer.nextMark();
                //
                lexer.check(Mark.INT);
                String length = lexer.intOrDecimalValue();
                column.setLength(Integer.parseInt(length));
                lexer.nextMark();
                //
                lexer.check(Mark.RIGHT_PAREN);
                lexer.nextMark();
                //
                lexer.check(Mark.DEFAULT);
                lexer.nextMark();
                //
                lexer.check(Mark.STRING);
                String defaultValue = lexer.stringValue;
                column.setDefaultValue(defaultValue);
                show(defaultValue);
                lexer.nextMark();
                //
            } else if (lexer.mark == Mark.DATE_TIME_LONG) {
                column.setDataType(Mark.DATE_TIME_LONG);
                lexer.nextMark();
                //
            }
            show(lexer.mark);
            newLine();
            lexer.check(Mark.SEMICOLON);
        }//end 修改字段列信息


        if (lexer.mark == Mark.RENAME) {
            lexer.nextMark();
            //
            lexer.check(Mark.TO);
            String oldTableName = lexer.stringValue;
            lexer.nextMark();
            //
            lexer.check(Mark.IDENTIFIER);
            String newTableName = lexer.stringValue;
            UpdateTableName updateTableName = new UpdateTableName();
            updateTableName.setOldTableName(oldTableName);
            updateTableName.setNewTableName(newTableName);
            lexer.nextMark();
            //
            return updateTableName;

        } else if (lexer.mark == Mark.CHANGE) {
            lexer.nextMark();
            lexer.check(Mark.IDENTIFIER);
            String oldColumnName = lexer.stringValue;
            lexer.nextMark();
            //
            lexer.check(Mark.TO);
            lexer.nextMark();
            //
            lexer.check(Mark.IDENTIFIER);
            String newColumnName = lexer.stringValue;
            UpdateColumnName updateColumnName = new UpdateColumnName();
            updateColumnName.setTableName(tableName);
            updateColumnName.setOldColumnName(oldColumnName);
            updateColumnName.setNewColumnName(newColumnName);
            lexer.nextMark();
            //
            return updateColumnName;
        } else if (lexer.mark == Mark.UPDATE) {
            doUpdate();
        } else if (lexer.mark == Mark.ADD || lexer.mark == Mark.MODIFY) {
            lexer.nextMark();

        } else if (lexer.mark == Mark.ADD) {
            lexer.nextMark();
            //
            lexer.check(Mark.INDEX);
            lexer.nextMark();
            //
            lexer.check(Mark.IDENTIFIER);
            String index = lexer.stringValue;
            AddIndex addIndex = new AddIndex();
            addIndex.setIndex(index);
            lexer.nextMark();
            //
            lexer.check(Mark.LEFT_PAREN);
            String columnName = "";
            int count = 0;
            do {
                lexer.nextMark();
                //
                lexer.check(Mark.IDENTIFIER);
                String s = lexer.stringValue;
                if (count == 0) {
                    columnName += s;
                } else {
                    columnName += "," + s;
                }
                lexer.nextMark();
                //
            } while (lexer.mark == Mark.COMMA);
            lexer.check(Mark.RIGHT_PAREN);
            addIndex.setColumnName(columnName);
            lexer.nextMark();
            //
            if (lexer.mark == Mark.INDEX) {
                addIndex.setIndexType(IndexType.INDEX);
            } else if (lexer.mark == Mark.UNIQUE) {
                lexer.nextMark();
                //
                lexer.check(Mark.INDEX);
                addIndex.setIndexType(IndexType.UNIQUE_INDEX);
            } else if (lexer.mark == Mark.PRIMARY) {
                lexer.nextMark();
                //
                lexer.check(Mark.KEY);
                addIndex.setIndexType(IndexType.PRIMARAY_KEY);
            } else {
                throw new RuntimeException("else...");
            }
            lexer.nextMark();
            //
            lexer.check(Mark.ON);
            lexer.nextMark();
            //
            lexer.check(Mark.TABLE);
            lexer.nextMark();
            //
            lexer.check(Mark.IDENTIFIER);
            addIndex.setTableName(tableName);
        } else if (lexer.mark == Mark.UPDATE) {
            lexer.nextMark();
            //
            if (lexer.mark == Mark.COLUMN) {
                UpdateColumnPostion updateColumnPostion = new UpdateColumnPostion();
                updateColumnPostion.setTableName(tableName);
                lexer.nextMark();
                //
                lexer.check(Mark.IDENTIFIER);
                String columnName = lexer.stringValue;
                updateColumnPostion.setColumnName(columnName);
                lexer.nextMark();
                //
                if (lexer.mark == Mark.AFTER) {
                    lexer.nextMark();
                    //
                    lexer.check(Mark.IDENTIFIER);
                    String afterColumnName = lexer.stringValue;
                    updateColumnPostion.setAfterColumnName(afterColumnName);
                    lexer.nextMark();
                } else {
                    updateColumnPostion.setPositionType(UpdateColumnPostion.FIRST);
                }
            }


        } else if (lexer.mark == Mark.DELETE) {
            lexer.nextMark();
            //
            if (lexer.mark == Mark.ER) {
                lexer.nextMark();
                //
                lexer.check(Mark.REFRENCE);
                lexer.nextMark();
                //
                lexer.check(Mark.IDENTIFIER);
                DeleteColumnERRefrence deleteColumnERRefrence = new DeleteColumnERRefrence();
                deleteColumnERRefrence.setTableName(tableName);
                lexer.nextMark();
                //
                return deleteColumnERRefrence;
            } else if (lexer.mark == Mark.COLUMN) {
                lexer.nextMark();
                //
                lexer.check(Mark.IDENTIFIER);
                String columnName = lexer.stringValue;
                DeleteColumn deleteColumn = new DeleteColumn();
                deleteColumn.setTableName(tableName);
                deleteColumn.setColumnName(columnName);
                lexer.nextMark();
                //
                return deleteColumn;
            }

        }        //

        else if (lexer.mark == Mark.DROP) {
            lexer.nextMark();
            //
            lexer.check(Mark.INDEX);
            lexer.nextMark();
            //
            lexer.check(Mark.IDENTIFIER);
            String index = lexer.stringValue;
            DropIndex dropIndex = new DropIndex();
            dropIndex.setTableName(tableName);
            dropIndex.setIndex(index);
            lexer.nextMark();
            //
            return dropIndex;
        }
        return null;
    }

    /**
     * 处理alter table add操作
     */
    public void doAdd() {
    }

    /**
     * 处理alter table update操作
     */
    public void doUpdate() {

    }

    //
}
